# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python2-nfqueue
pkgver=0.4
pkgrel=11
pkgdesc="Python bindings for libnetfilter_queue by Pierre Chifflier"
url="https://www.wzdftpd.net/redmine/projects/nfqueue-bindings/wiki/"
arch=('x86_64' 'aarch64')
license=('GPL')
depends=('python2' 'libnetfilter_queue')
makedepends=('python2-setuptools' 'cmake' 'swig')
source=("http://ftp.de.debian.org/debian/pool/main/n/nfqueue-bindings/nfqueue-bindings_$pkgver.orig.tar.gz"
        python-support.patch)
sha512sums=('2469447b84b11afd448ea7cd8bf50d4d4227f532bf0e2ddbef963f9e2c1d5a272fe210ba06df2a44661bd43b989de60cc6338f3a4d7978709963a7ef5bbc0992'
            'c652509dee7a26a24202e44d81b51bffcbff2e9e8b9b31e9c187d46ea4d05a1f1194338eb18be9da18a9ec00b35c7342e3efb9b68841e778b1657f5815e92c54')

prepare() {
  cd "nfqueue-bindings-$pkgver"

  patch -p1 -i ../python-support.patch

  # I don't feel like editing the patch.
  sed -i 'i\#include <stdint.h>' nfq.h
  sed -i 's/dist-packages/site-packages/' python/CMakeLists.txt
}

package() {
  cd "nfqueue-bindings-$pkgver"

  # Examples.
  install -dm 755 -p "$pkgdir/usr/share/doc/nfqueue-bindings/examples"
  install -m644 examples/*.py "$pkgdir/usr/share/doc/nfqueue-bindings/examples"

  # Library.
  make PREFIX="$pkgdir/usr" install
}

